package vote.ai.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import vote.ai.domain.enums.CorrectState;
import vote.ai.domain.vo.TextCorrectionMatchResp;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Schema(description = "文本纠错任务详情")
@TableName(value = "text_correct_task_details", autoResultMap = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CorrectTaskDetails implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Long id;
    private String taskId;
    private int sort;
    private String sentence;
    private int startIndex;
    private int endIndex;
    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private List<TextCorrectionMatchResp> result;
    @Version
    private int version;
    private CorrectState state = CorrectState.UNKNOWN;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;
}
